import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo02 {
    public static void main(String[] args) {
        //获取系统当前日期
        Date  now=new Date();
        //2008-8-18
        Date beforeDate=new Date(108,7,18);
        //日期格式化类
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String nowStr=sdf.format(now); //format将日期对象转成指定格式的字符串
        String beforeDateStr=sdf.format(beforeDate);
        System.out.println(nowStr);
        System.out.println(beforeDateStr);

        System.out.println(now.getTime());
        System.out.println(beforeDate.getTime());

    }
}
